﻿Imports Tohto.Base.DBUtility
Imports Tohto.Base.Entity
Imports Oracle.DataAccess.Client
Imports System.Text
Public Class UT0100P01B01

    ''' <summary>
    ''' 工事参照
    ''' </summary>
    ''' <param name="strLoginid">ログイン情報．ログインID</param>
    ''' <param name="strI_VC_KOJI_NO">工事No.</param>
    ''' <param name="strI_VC_KOJI_NM">工事名</param>
    ''' <param name="strI_VC_KOJI_KB">工事区分</param>
    ''' <param name="strI_VC_KOJI_ST">工事案件状態</param>
    ''' <param name="strI_VC_ARTICLE_CD">物件CD</param>
    ''' <param name="strI_VC_ARTICLE_NM_KANA">物件名(カナ)</param>
    ''' <param name="strI_DT_KANRYO_DT_FROM">工事案件完了日From</param>
    ''' <param name="strI_DT_KANRYO_DT_TO">工事案件完了日To</param>
    ''' <param name="strI_VC_TANTO_POST_CD">工事担当部署CD</param>
    ''' <param name="strI_VC_TANTO_EMP_CD">工事担当者CD</param>
    ''' <param name="errInfo"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function Fetch_LIST(ByVal strLoginid As String, _
                               ByVal strI_VC_KOJI_NO As String, _
                               ByVal strI_VC_KOJI_NM As String, _
                               ByVal strI_VC_KOJI_KB As String, _
                               ByVal strI_VC_KOJI_ST As String, _
                               ByVal strI_VC_ARTICLE_CD As String, _
                               ByVal strI_VC_ARTICLE_NM_KANA As String, _
                               ByVal strI_DT_KANRYO_DT_FROM As String, _
                               ByVal strI_DT_KANRYO_DT_TO As String, _
                               ByVal strI_VC_TANTO_POST_CD As String, _
                               ByVal strI_VC_TANTO_EMP_CD As String, _
                               ByVal errInfo As PLSQLErrorInfo) As DataTable

        errInfo.Clear()

        Dim strCmdText As String
        strCmdText = "PG_UT0100.FETCH_LIST"

        Dim parameters(13) As OracleParameter

        'ログインID
        Dim I_VC_LOGIN_ID As New OracleParameter("I_VC_LOGINID", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_LOGIN_ID.Value = strLoginid

        '工事No.
        Dim I_VC_KOJI_NO As New OracleParameter("I_VC_KOJI_NO", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_NO.Value = strI_VC_KOJI_NO

        '工事名
        Dim I_VC_KOJI_NM As New OracleParameter("I_VC_KOJI_NM", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_NM.Value = strI_VC_KOJI_NM

        '工事区分
        Dim I_VC_KOJI_KB As New OracleParameter("I_VC_KOJI_KB", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_KB.Value = strI_VC_KOJI_KB

        '工事案件状態
        Dim I_VC_KOJI_ST As New OracleParameter("I_VC_KOJI_ST", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_KOJI_ST.Value = strI_VC_KOJI_ST

        '物件CD
        Dim I_VC_ARTICLE_CD As New OracleParameter("I_VC_ARTICLE_CD", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_ARTICLE_CD.Value = strI_VC_ARTICLE_CD

        '物件名(カナ)
        Dim I_VC_ARTICLE_NM_KANA As New OracleParameter("I_VC_ARTICLE_NM_KANA", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_ARTICLE_NM_KANA.Value = strI_VC_ARTICLE_NM_KANA

        '工事案件完了日From
        Dim I_DT_KANRYO_DT_FROM As New OracleParameter("I_DT_KANRYO_DT_FROM", OracleDbType.Varchar2, ParameterDirection.Input)
        I_DT_KANRYO_DT_FROM.Value = strI_DT_KANRYO_DT_FROM

        '工事案件完了日To
        Dim I_DT_KANRYO_DT_TO As New OracleParameter("I_DT_KANRYO_DT_TO", OracleDbType.Varchar2, ParameterDirection.Input)
        I_DT_KANRYO_DT_TO.Value = strI_DT_KANRYO_DT_TO

        '工事担当部署CD
        Dim I_VC_TANTO_POST_CD As New OracleParameter("I_VC_TANTO_POST_CD", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_TANTO_POST_CD.Value = strI_VC_TANTO_POST_CD

        '工事担当者CD
        Dim I_VC_TANTO_EMP_CD As New OracleParameter("I_VC_TANTO_EMP_CD", OracleDbType.Varchar2, ParameterDirection.Input)
        I_VC_TANTO_EMP_CD.Value = strI_VC_TANTO_EMP_CD


        Dim O_CU_KOJI_ANKEN_ICHIRAN As New OracleParameter("O_CU_KOJI_ANKEN_ICHIRAN", OracleDbType.RefCursor, ParameterDirection.Output)
        Dim O_CU_ERR As New OracleParameter("O_CU_ERR", OracleDbType.RefCursor, ParameterDirection.Output)

        Dim O_STATS As New OracleParameter("O_STATS", OracleDbType.Int32, ParameterDirection.ReturnValue)

        parameters(0) = I_VC_LOGIN_ID
        parameters(1) = I_VC_KOJI_NO
        parameters(2) = I_VC_KOJI_NM
        parameters(3) = I_VC_KOJI_KB
        parameters(4) = I_VC_KOJI_ST
        parameters(5) = I_VC_ARTICLE_CD
        parameters(6) = I_VC_ARTICLE_NM_KANA
        parameters(7) = I_DT_KANRYO_DT_FROM
        parameters(8) = I_DT_KANRYO_DT_TO
        parameters(9) = I_VC_TANTO_POST_CD
        parameters(10) = I_VC_TANTO_EMP_CD
        parameters(11) = O_CU_KOJI_ANKEN_ICHIRAN
        parameters(12) = O_CU_ERR
        parameters(13) = O_STATS

        Dim ds As DataSet

        ds = OracleHelp.FillTable(OracleHelp.ConnectionStringLocalTransaction,
                                          CommandType.StoredProcedure,
                                          strCmdText,
                                          errInfo,
                                          parameters)

        Return ds.Tables(0)


    End Function
End Class
